<?php

/**
 * Haefko - your php5 framework
 *
 * @author      Jan Skrasek <skrasek.jan@gmail.com>
 * @copyright   Copyright (c) 2008, Jan Skrasek
 * @link        http://haefko.programujte.com
 * @version     0.7
 * @package     Haefko
 */

?>
<style type="text/css" media="screen">
#hf-debug-toolbar {
    opacity: 0.3;
    background: #222;
    border-bottom: 1px solid #aaa;
    border-right: 1px solid #aaa;
    color: #ddd;
    position: fixed;
    top: 0;
    left: 0;
    text-align: left;
    font-size: 13px;
    font-family: sans-serif;
    width: 18px;
    height: 16px;
    overflow: hidden;
}

#hf-debug-toolbar:hover {
    opacity: 1;
    width: auto;
    height: auto;
}

#hf-debug-toolbar a {
    color: white;
    text-decoration: none;
}

#hf-debug-toolbar-config, #hf-debug-toolbar-sql {
    border: 1px solid #444;
    border-collapse: collapse;
    background: #333;
    margin: 2px 0 0 0;
    padding: 2px;
}

#hf-debug-toolbar-config strong {
    color: #ddd;
}

#hf-debug-toolbar-sql td, #hf-debug-toolbar-sql th {
    background: #333;
    color: #ddd;
    border: 1px solid #666;
    padding: 0 3px;
}

#hf-debug-toolbar-sql td {
    background: #444;
}

</style>
<script type="text/javascript">
//<![CDATA[
function hftoolbarToogler(id, id2) {
    div = document.getElementById(id2);
    if (div)
        div.style.display = 'none';
    div = document.getElementById(id);
    div.style.display = (div.style.display == '') ? 'none' : '';
}
//]]>
</script>
<div id="hf-debug-toolbar">
    <div id="hf-debug-toolbar-toolbar">
        HF <span style="font-size: 12px">v.<?= Application::$version ?></span> ::
        <?= Debug::getTime() ?> ms ::
        <a href="javascript:hftoolbarToogler('hf-debug-toolbar-config', 'hf-debug-toolbar-sql')">config</a>
        <?php if (!empty($sql)) { ?>&nbsp; :: <a href="javascript:hftoolbarToogler('hf-debug-toolbar-sql', 'hf-debug-toolbar-config')">sql</a><?php } ?>
    </div>

    <?php if (!empty($sql)) { ?>
    <table style="display: none" id="hf-debug-toolbar-sql">
        <tr><th>SQL</th><th>time</th><th>rows</th></tr>
        <?php foreach ($sql as $row) { ?>
        <tr><td><?= $row['sql'] ?></td><td><?= sprintf('%0.3f', $row['time'] * 1000) ?> ms</td><td><?= $row['rows'] ?></td></tr>
        <?php } ?>
    </table>
    <?php } ?>

    <div id="hf-debug-toolbar-config" style="display: none;">
        <?= self::readableArray(Config::getConfig()) ?>
    </div>
</div>